<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>蒙态对话框</title>
    <style>
        .back{
            background-color: #396bb3;
            height: 600px;
        }
        .shade{
            position: fixed;
            background-color: pink;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            width: auto;
            opacity: 0.4;
        }
        .model{
            position: fixed;
            background-color: yellow;
            top: 50%;
            left: 50%;
            width: 200px;
            height: 200px;


        }
        .hide{
            display: none;
        }
    </style>
</head>
<body>
<div class="back">
    <input type="button" id="ID1" onclick="action1(this)" value="显示">
</div>
<div class="shade hide"></div>
<div class="model hide">
    <input type="button" id="ID2" onclick="action2(this)" value="取消">
</div>

<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
<script>
    function action1(self){
        $(self).parent().siblings().removeClass("hide")
    }
    function action2(self){
        $(self).parent().addClass('hide').prev().addClass('hide')
        // $(self).parent().parent().children(".model,.shade").addClass('hide')
    }
</script>
</body>
</html>